package com.bdqn.controller;


import com.bdqn.entity.responseDate.pmsProduct.PmsProductAttributeDto;
import com.bdqn.entity.util.RespBean;
import com.bdqn.service.PmsProductAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 商品属性表 前端控制器
 * </p>
 *
 * @author hunter
 * @since 2022-04-30
 */
@RestController
@RequestMapping("/pms/product/attribute")
public class PmsProductAttributeController {
    @Autowired
    private PmsProductAttributeService pmsProductAttributeService;

    //    根据商品二级分类ID查询商品属性列表接口
    @PostMapping("/byCategoryIds")
    public RespBean byCategoryIds(@RequestBody long[] categoryIds) {
        System.out.println("获取的信息"+categoryIds);
        List<PmsProductAttributeDto> listByCategoryIds = pmsProductAttributeService.getListByCategoryIds(categoryIds);
        if (listByCategoryIds.size() > 0) {
            return RespBean.ok("根据商品二级分类ID查询商品属性列表成功",listByCategoryIds);
        }else {
            return RespBean.err("根据商品二级分类ID查询商品属性列表失败");
        }
    }

}
